<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\Pjax;
/* @var $this yii\web\View */
/* @var $searchModel app\modules\Member\models\MemberSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t('app.member', 'Members');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="member-index">

     <h2 class="page-header">
        <?= Html::encode($this->title) ?>   
        <p class="pull-right"> 
            <?= Html::a('同业客户管理', ['others'], ['class' => 'btn btn-danger']) ?>
            <?= Html::a(Yii::t('app.member', 'Create Member'), ['create'], ['class' => 'btn btn-success']) ?>
        </p>
    </h2>

<?php Pjax::begin(); ?> 
     <p><?php  echo $this->render('_search', ['model' => $searchModel]); ?></p> 
     <?= GridView::widget([
        'dataProvider' => $dataProvider,
        // 'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

           // 'id',
            'name',
            'phone',
            'mail',
            //'password',
            // 'address',
            //'position',
            [
                'attribute' => 'position',
                'filter' =>  Yii::$app->params['position'],
                'value' => function ($model) {
                        return isset(Yii::$app->params['position'][$model->position]) ? Yii::$app->params['position'][$model->position] : '-';
                    },
            ],
            //'group',
            [
                'attribute' => 'group',
                'filter' =>  Yii::$app->params['work_group'],
                'value' => function ($model) {
                        return isset(Yii::$app->params['work_group'][$model->group]) ? Yii::$app->params['work_group'][$model->group] : '-' ;
                    },
            ],
            // 'dist_id',
            // 'type',
            [
                'attribute' => 'type',
                'filter' =>  Yii::$app->params['memberType'],
                'value' => function ($model) {
                        return Yii::$app->params['memberType'][$model->type];
                    },
            ],
            // 'desc',
            // 'status',
            // 'created_at',
            // 'updated_at',
            // 'gender',
            [
                'attribute' => 'status',
                'filter' =>  Yii::$app->params['status'],
                'value' => function ($model) {
                        return Yii::$app->params['status'][$model->status];
                    },
            ],
             [
                'class' => 'yii\grid\ActionColumn',
                'template' =>"{view} {update}"
            ],
        ],
    ]); ?>
<?php Pjax::end(); ?></div>
